<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>计算属性</title>
</head>

<body>
    <div class="app">
        <div>{{msg}}</div>
        <div>{{msg.split('').reverse().join('')}}</div>
        <div>{{msgStr}}</div>
        <div>{{ageHan}}</div>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        var xm = new Vue({
            el: '.app',
            data: {
                msg: 'hello',
                age: 20
            },
            methods: {
            },
            computed: {
         msgStr: function() {
             return this.msg.split('').reverse().join('')
         },
         ageHan: function() {
             return this.age === 20 ? '我成年了' : '我还小'
         }
            }
              
        })

    </script>
</body>

</html>